from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    # pydantic-settings v2 config
    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",  # 忽略未声明的环境变量，避免 extra_forbidden 报错
    )
    # API
    debug: bool = True
    log_level: str = "info"

    # Target DB (only required database)
    target_db_type: str = "postgresql"  # mysql|postgresql|sqlite
    target_db_host: str = "localhost"
    target_db_port: int = 5432
    target_db_user: str = "postgres"
    target_db_password: str = "123456"
    target_db_name: str = "postgres"
    target_db_charset: str = "utf8"
    target_db_schema: str = "wd-tv-data"  # PostgreSQL schema (search_path)

    # AI
    openai_api_key: str | None = None
    openai_base_url: str | None = None


settings = Settings()


